<?php



include "config.php";
if($_SERVER["REQUEST_METHOD"]=="POST"){
    $u_id=isset($_POST["u_id"])?$_POST["u_id"]:"";
    $p_id=isset($_POST["p_id"])?$_POST["p_id"]:"";
    $sqlcarts="DELETE FROM carts WHERE u_id=? AND p_id=?;";
    $stmt=$connection->prepare($sqlcarts);
    $stmt->bind_param("ii",$u_id,$p_id);
    $stmt->execute();
   if($stmt->affected_rows>=1){
       print_r(json_encode(array("status"=>1,"mas"=>"获取carts库成功")));
   }else{
       print_r(json_encode(array("status"=>-1,"mas"=>"删除失败")));
   }
    $stmt->close();
    $connection->close();

}
else{
    print_r(json_encode(array("status"=>0,"mas"=>"不支持GET请求")));
}
